using System;
using System.Collections;
using UnityEngine;
using Yoozoo.Framework.Core;
using Yoozoo.Gta.Common;


public class DebugComponent : SingletonMono<DebugComponent>
{
    [Header("点击内城建筑显示坐标")]
    public bool ClickShowPos;


    [Header("是否显示沙盘客户端范围网格")]
    public bool ShowRangeGrid;

    [Header("沙盘客户端偏移范围网格W")]
    public int changeGrid_W_Num = 0;
    [Header("沙盘客户端偏移范围网格H")]
    public int changeGrid_H_Num = 0;

    [Header("是否显示沙盘服务器范围网格")]
    public bool ShowRangeGrid2;

    private void Update()
    {
        DebugSetting.ClickShowPos = ClickShowPos;
        #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.A))
        {
            ResidentHandler.Inst.GetFunction("L_RpgManager.TestPressA").Action();
        }
        #endif
    }


    public void GcCollect()
    {
        for (int i = 0; i < 6; i++)
        {
            System.GC.Collect();
        }
        // StartCoroutine(GcCoroutineFunc());
    }


    private IEnumerator GcCoroutineFunc()
    {
        for (int i = 0; i < 6; i++)
        {
            System.GC.Collect();
            System.GC.WaitForPendingFinalizers();
            System.GC.Collect();
            yield return new WaitForSeconds(1f);
        }
    }
}
